<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>156-事件-物体随着鼠标移动.html</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		#box{
			position: absolute;
			left: 0;
			top: 0;
			width: 100px;
			height: 100px;
			background-color:yellow;
		}
	</style>
</head>
<body>
	<div id="box"></div>
</body>
<script src="js/util.js"></script>
<script>
	var oBox = document.getElementById('box');
	document.onmousemove = function(ev){
		console.log(ev.clientX,ev.clientY);
		oBox.style.left = getScrollLeft() + ev.clientX + 'px';
		oBox.style.top = getScrollTop() + ev.clientY + 'px';
	}
</script>
</html>